<?php
class Model_Category_Access extends Model_Category_Info
{
	public function showAll($lang)
	{
		return $this->db->queryForList('category.showAll',array($lang));
	}
	
	public function delete($id)
	{
		$this->db->query('category.delCategory', array($id));
		$this->db->query('category.delCategoryLanguage', array($id));
	}
	
	public function getMaxOrder()
	{
		$maxOrder = $this->db->queryForObject('category.getMaxOrder', array());
		return $maxOrder->c_order  ;
	}
	
	public function insertCategory($order)
	{
		return $this->db->query('category.insertCategory', array($order));	
	}

	public function insertCategoryLanguage($c_id, $l_id, $cl_name, $cl_description)
	{
		return $this->db->query('category.insertCategoryLanguage', array($c_id, $l_id, $cl_name, $cl_description));
	}
	
	public function getLastestCatId()
	{
		return $this->db->lastInsertId();
	}
	
	public function checkExistCategory($c_id, $l_id)
	{
		return $this->db->queryForObject('category.checkExistCategory', array($c_id, $l_id));
	}
	
	public function updateCategoryLanguage($name, $description, $c_id, $l_id)
	{
		return	$this->db->query('category.updateCategoryLanguage', array($name, $description, $c_id, $l_id));
	}
}
?>